const global = require('global');
cc.Class({
    extends: cc.Component,

    properties: {
		btnnode:cc.Node,	
		jjcell:cc.Prefab,
    },

    onLoad () {
		//生成结局cell
		this.createjj();
		
    },

    returnbtn() {
		this.node.opacity = 0;
		cc.director.getScheduler().schedule(() => {
			this.node.x += 20;
		}, this, 1/64, 63);
	},
	createjj(){
		let len = global.endlist.length-1;
		for(let i = len;i >= 1;i--){
			let idx = len-i+1,jj = global.endlist[idx];
			let jjcell = cc.instantiate(this.jjcell);
			jjcell.parent = this.btnnode;
			let bhLabel = jjcell.getChildByName('gkButton').getChildByName('idx').getComponent(cc.Label);
			let desLabel = jjcell.getChildByName('gkButton').getChildByName('des').getComponent(cc.Label);
			if(jj.reach == 0){
				bhLabel.string = '关卡'+jj.guanka;
				desLabel.string = '? ? ?';
			}else{
				bhLabel.string = '编号'+idx;
				desLabel.string = jj.des;
			}
		}
	}
    // update (dt) {},
});
